library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;

entity twoscomplement is
  generic (
	 n : integer := 8
	 	);
  port (
        input  : in  std_logic_vector((n-1) downto 0);
        output : out std_logic_vector((n-1) downto 0)
  );
end;

architecture simple of twoscomplement is
begin
  process(input)
      variable inv : unsigned((n-1) downto 0);
  begin
	inv := unsigned(NOT input);
	inv := inv + 1;
	output <= std_logic_vector(inv);
  end process;
end;